<%--
  Created by IntelliJ IDEA.
  User: ZXW
  Date: 2019/8/18
  Time: 21:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@page isELIgnored="false"%>
<!DOCTYPE html>
<html>

<head>
    <title>用户信息</title>
    <script type="text/javascript" src="${requestPath}/resources/js/jquery-3.4.1.js"></script>
</head>
<body>
<div align="center">
<table border="1" width="400">
    <tr>
        <th>编号</th>
        <th>用户</th>
        <th>密码</th>
        <th>邮箱</th>
        <th>电话</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${userList}" var="user">
        <tr>
            <td>${user.id}</td>
            <td>${user.userName}</td>
            <td>******</td>
            <td>${user.email}</td>
            <td>${user.phoneNumber}</td>
            <td>
                <form action="/uploadFile" method="post" enctype="multipart/form-data">
                    <input type="file" name="document" multiple="multiple"/>
                    <input type="hidden" name="Id" value="${user.id} ">
                    <input type="submit" value="上传简历"/>
                <a href="/interUpdate?Id=${user.id}" >更新</a>
                <a href="#" onclick="deleteUser('${user.id}')">删除</a>
                    <a href="/selectFile?Id=${user.id}">文件查找</a>
                </form>
            </td>
        </tr>
    </c:forEach>
</table>
                       <a href="/interRegister">注册</a>
</div>
<script>
    function deleteUser(id) {
        var flag =confirm("是否删除"+id+"？");
        if(!flag){
            return;
        }
        $.ajax(
            {
                url:"${requestPath}/interDelete?Id="+id,
                async:false,
                type:'get',
                success:function (data) {
                    if(data.flag){
                        alert("删除成功！");
                        location.href="${requestPath}/query";
                    }else{
                        alert(data.msg);
                    }
                }
            }
            );
    }
</script>
</body>
</html>
